/*
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License Version
 *  3 as published by the Free Software Foundation.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
 *  USA.
 */

#include <optra/common/guiwindow.h>
#include <QtWebKit>

using namespace Optra;
GuiWindow::GuiWindow(QWidget* parent, Op::WindowStyle style):
        QWidget(parent), style_(style), htmlView_(0)
{
    if (style_ == Op::html){
        htmlView_ = new QWebView(this);
        QVBoxLayout *layout = new QVBoxLayout;
        layout->addWidget(htmlView_);
        layout->setSpacing(0);
        setLayout(layout);        
    }
}

GuiWindow::~GuiWindow()
{
    delete htmlView_;
}


void GuiWindow::setUrl(const QString& url)
{
    htmlView_->setUrl(QUrl(url));
}

void GuiWindow::setHtml(const QString& html)
{
   htmlView_->setHtml(html);
}
